home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
comm
/
xeno
/
megacd.lha
/
megacd
/
MegaReq.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-10-01
|
15KB
|
577 lines
/****************************************************************/
/* */
/* MegaReq.rexx v1.01 ⌐ David Huckett.. */
/* Request Utility for MegaCD & Xenolink. */
/* By David Huckett 23-Sep-95 3:640/800 Fido */
/****************************************************************/
/* WARNING CD-ROMs that have no name and show up on Workbench as Unnamed
** must only be used one at a time.. You can not have three volumes
** loaded in drives all called Unnamed.. It will confuse the door.
*/
MAXMARKED = '5'
ENFORCERATIOS = 'Y'
REQPATH = 'Doors:MegaCD/Requests/'
BUFFERDIR = 'Doors:MegaCD/BUFFER/'
CDCFG = 'Doors:MegaCD/CD.cfg'
SEARCHPATH= 'Doors:MegaCD/Search/'
VERS = 'MegaReq v1.01'
/****** EXTENSION REPLACEMENTS **********/
LHA = 'ED'x; DMS = 'E0'x; LZH = 'E1'x; TXT = 'E2'x; DOC = 'E3'x; MOD = 'E4'x
ZIP = 'E5'x; ZOO = 'E6'x; ARC = 'E7'x; EXE = 'E8'x; LZX = 'E9'x; ARJ = 'EA'x
GIF = 'EB'x; TIF = 'EC'x; BMP = 'EE'x; JPG = 'EF'x; PCX = 'F0'x
options results
SysopLog 'Entered Door: MegaReq.'
PR = 'PRINT'
arg Node_Number CDName ConfigCd
host = 'XenolinkRexxPort'Node_Number
address value host
signal on error
signal on syntax
signal on IOERR
if ~show('L','rexxsupport.library') then do
if ~addlib('rexxsupport.library',0,-30,0) then do
PR 'Support library not available.'
call error
signal Quit
end
end
getuservar name ; nicename strip(result); name = result
getuservar privilege ; access = result
getuservar fileratio ; fileratio = result
getuservar uploads ; uploads = result
getuservar downloads ; downloads = result
If Downloads = 0 & Uploads = 0 Then Uploads = 1
If FileRatio = 0 Then do
ActFileRatio = 'Unlim'
end
else ActfileRatio = FileRatio
If EnforceRatios = 'Y' Then do
If FileRatio ~= 0 Then do
NumRemain = (Uploads * FileRatio) - Downloads
If Numremain < 1 Then NumRemain = 0
End
If NumRemain <1 Then Signal Ratio
IF MaxMarked > Numremain Then MaxMarked = NumRemain
End
fullname = SPACE(name,1,_)
GETUSERVAR MENUSET
gfx=result
if gfx >='1' then do
WHI='
';RED='
';GRN='
';BGRN='
';YEL='
';BYEL='
';BLU='
';MAJ='
';CYA='
';BCYA='
';OFF='
'
END
ELSE DO
WHI='';RED='';GRN='';BGRN='';YEL='';BYEL='';BLU='';MAJ='';CYA='';OFF='';BCYA=''
END
START:
CLS
pr BLU' ┌───────────────────────────────────┐'
pr ' │'BGRN' Offline CD-Rom Request Utility'OFF||BLU' │'
pr BLU' │ │'
pr BLU' │'BCYA' 'VERS||OFF||BLU' │'
pr BLU' │'BCYA' by David Huckett 16-Sep-95..'OFF||BLU' │'
pr BLU' └───────────────────────────────────┘'OFF
pr
pr ' ('GRN'R'OFF') Request a file.'
pr ' ('GRN'K'OFF') Delete your request.'
pr ' ('GRN'V'OFF') View your requests.'
pr ' ('GRN'D'OFF') Download Waiting Files.'
pr ' ('GRN'A'OFF') About MegaREQ.'
pr ' ('RED'Q'OFF') Quit.'
pr
prompt 20 normal BYEL' Make your selection > 'OFF
cmd=strip(upper(result))
SELECT
when cmd = 'A' then signal About
when cmd = '' then signal start
when cmd = 'V' then signal View
when cmd = 'K' then signal DelReq
when cmd = 'D' then signal Download
when cmd = 'R' then signal Request
when cmd = "###PANIC" then call Quit
when left(cmd,1)='Q' then signal quit
OTHERWISE
pr
pr 'Unkown Command 'cmd
call delay 50
signal start
DOWNLOAD:
if ~exists(REQPATH||Fullname'.fnd') then do
pr
pr 'There are no buffered requests waiting for you to download..'
call delay 100
signal start
end
if ~exists('T:MRXDL'node_Number'.sfl') Then call open(tempdl,'T:MRXDL'node_Number'.sfl','W')
else Call open(Tempdl,'T:MRXDL'node_Number'.sfl','A')
Call open(rfile,REQPATH||FULLNAME'.fnd',R)
Do i = 1 Until EOF(rfile)
FILENAME.i = strip(Readln(rfile))
if filename.i = '' then leave i
Call WriteLn(Tempdl,BUFFERDIR FILENAME.i)
end
Call close(Tempdl)
Call close(rfile)
address command 'DELETE 'REQPATH||FULLNAME'.fnd QUIET'
pr
pr ' You may now use MegaRXDL to download your requested files...'
pr ' When you have exited MegaCD, please use the download command normally'
pr ' used to download files from the CD's.... '
pr
msg 'Any key to continue..'
Getchar
exit 0
/***************** View Requests *******************/
VIEW:
If ~EXISTS(REQPATH||FULLNAME'.req') Then Do
pr
pr ' No saved file requests found....'
call delay 100
signal START
END
Else do
CLS
PR
Call open(rfile,REQPATH||FULLNAME'.req',R)
Do i = 1 UNTIL EOF(rfile)
rquest.i = strip(readln(rfile))
if rquest.i = '' then do
i=i-1
iterate
end
pr left(' 'i'.',4)||left(word(rquest.i,4),25)'Requested on: 'word(rquest.i,1)
end
call close(rfile)
pr
msg 'Hit any key to continue..'
getchar
signal start
/**************** Delete requests *****************/
DELREQ:
If ~EXISTS(REQPATH||FULLNAME'.req') Then Do
pr
pr ' No saved file requests found....'
call delay 100
signal START
END
Else do
CLS
PR
Call open(rfile,REQPATH||FULLNAME'.req',R)
Do i = 1 UNTIL EOF(rfile)
rquest.i = strip(readln(rfile))
if rquest.i = '' then do
i=i-1
iterate
end
pr left(' 'i'.',4)||left(word(rquest.i,4),25)'Requested on: 'word(rquest.i,1)
end
call close(rfile)
numreqs = i
pr
pr YEL'Enter the number of the request to delete,'
prompt 4 normal YEL'ALL to delete all, or hit <return> to abort.. '
ans = strip(upper(result))
if ans = '' then signal start
if ans = 'ALL' then do
call open(delfile,REQPATH||FULLNAME'.req', 'R')
do i = 1 until EOF(delfile)
kill.i = word(readln(delfile),4)
if kill.i = '' then iterate
if exists(BUFFERDIR||Kill.i) then do
killcmd = 'DELETE 'BUFFERDIR||Kill.i' QUIET'
address command killcmd
end
end
call close(delfile)
address command 'DELETE 'REQPATH||FULLNAME'.req QUIET'
if exists(REQPATH||FULLNAME'.fnd') then address command 'DELETE 'REQPATH||FULLNAME'.fnd QUIET'
pr 'ALL Requests deleted...'
call delay 100
signal start
end
if Datatype(ans, 'N') = 1 then do
if ans<= i then call DELETE(ans)
else pr RED'You dont have that many requests.'OFF
call delay 100
signal start
end
pr ' Unknown command: 'ans
msg 'Hit any key'
getchar
signal start
DELETE:
PARSE ARG line
filetokill = word(rquest.line,4)
Call open(rfile,REQPATH||FULLNAME'.req',w)
Do i = 1 to numreqs-1
if line = i then iterate i
call writeln(rfile,rquest.i)
end
call close(rfile)
if exists(BUFFERDIR||filetokill) then do
killcmd = 'DELETE 'BUFFERDIR||filetokill' QUIET'
address command killcmd
end
pr
pr CYA||FileToKill||RED' deleted!'OFF
pr
msg 'Any key to continue..'
getchar
signal start
/**************** REQUEST FILES *******************/
REQUEST:
i=0
if exists(REQPATH||FULLNAME'.req') then do
Call open(rfile,REQPATH||FULLNAME'.req',R)
Do i = 1 UNTIL EOF(rfile)
Junk.i = readln(rfile)
if Junk.i = '' then do
i=i-1
iterate
end
end
call close(rfile)
end
numreqs = i
if NUMREQS >= MAXMARKED then do
pr
pr 'You have the maximum ('GRN||MAXMARKED||OFF') requests pending on you account..'
pr 'Some requests may have been filled, so delete any of these filled'
pr 'requests first, or remove any unwanted requests from your list to'
pr 'enable further new requests..'
pr 'If you believe there may be a problem (bugs may exist) contact'
pr 'the sysop....'
pr
msg 'Any key to continue..'
getchar
signal start
end
FileName = ''
Directory = ''
CLS
pr
pr BLU' ┌─────────────────────────────────────────────────┐'
pr ' │ │'
pr ' │'GRN' Date: 'CYA||left(Date(),30)||BLU'│'
pr ' │ │'
pr ' │'GRN' Requested by: 'CYA||left(Name,30)||BLU'│'
pr ' │ │'
pr ' │'GRN' File Requested:'BLU' │'
pr ' │ │'
pr ' │'GRN' CD-Rom: 'CYA||left(cdname,15)||BLU' │'
pr ' │ │'
pr ' └─────────────────────────────────────────────────┘'OFF
pr
pr
GetFileName:
Getline 30 Normal YEL' Enter the requested filename: 'OFF
Filename = Strip(Result)
if filename = '' then signal start
msg BYEL "8H"Left(FileName,30)"1H"
/************* Request Prompt ************/
RPROMPT:
do until ans = ''
msg GRN"1H ('OFF'A'GRN') Change Filename. ('OFF'B'GRN') Cancel Request.."OFF
msg GRN"1H If all acceptable hit <'OFF'return'GRN'>.1H"OFF
Getline 30 Normal YEL' ('OFF'A'YEL'),('OFF'B'YEL'),<'OFF'return'YEL'>: 'OFF
answer = Strip(Upper(Result))
msg '1H1H1H'
SELECT
WHEN answer = 'A' then call GetFileName
WHEN answer = 'B' then Call Cancel
WHEN answer = '' then break
OTHERWISE NOP
END
end
if Filename = '' then do
cls
pr
pr RED' No file requested'OFF
end
else signal savefilereq
Signal Start
/**************** SaveFileRequest *****************/
SAVEFILEREQ:
cls
pr
msg GRN' Saving request.'OFF
find1 = strip(Filename)
find = upper(find1)
noExt = 0
extens = right(find,4)
SELECT
When extens = '.LHA' then find = left(find,(length(find)-4))||upper(LHA)
When extens = '.ZIP' then find = left(find,(length(find)-4))||upper(ZIP)
When extens = '.DMS' then find = left(find,(length(find)-4))||upper(DMS)
When extens = '.MOD' then find = left(find,(length(find)-4))||upper(MOD)
When extens = '.LZH' then find = left(find,(length(find)-4))||upper(LZH)
When extens = '.TXT' then find = left(find,(length(find)-4))||upper(TXT)
When extens = '.EXE' then find = left(find,(length(find)-4))||upper(EXE)
When extens = '.JPG' then find = left(find,(length(find)-4))||upper(JPG)
When extens = '.GIF' then find = left(find,(length(find)-4))||upper(GIF)
OTHERWISE NoExt = 1
end
IndTIT = CDName
If ~exists(SearchPath||IndTIT||'.dex') then do
pr
pr 'Cant find a Search index file for this CD-Rom...'
pr 'Ask the sysop to create one so Requests can be made from that CD-Rom...'
msg 'Any key to continue...'
getchar
Exit 0
end
fnd = 0
if NoExt = 0 then find = left(find,(length(find)-1))
c = 0
call open(fllist,SearchPath||IndTIT||'.dex','R')
Findpath = Readln(fllist)
do l =1 until EOF(fllist)
c = c+1
if c = 4 then do
msg '.'
c= 0
end
findln.l = Readln(fllist)
findln.l = Upper(findln.l)
t= index(findln.l,find)
if t ~= 0 then do
configCD = strip(configCD)
call open(ccfg,configCD, 'R')
cdpathname = readln(ccfg)
indexpath = readln(ccfg)
displayfile = readln(ccfg)
skipstart = readln(ccfg)
do j = 1 to word(findln.l,1)
directory = word(readln(ccfg),1)
end
call close(ccfg)
fnd = 1
pr 'Done!'
leave l
end
end
call close(fllist)
if fnd ~= 0 then signal FOUND
pr
pr CYA'File not found on this CD.. Was spelling correct?'OFF
getchar
Exit 0
FOUND:
PathFile = left(Indexpath||directory,50)
day = left(space(date(),1,_),15)
username = Left(FullName,30)
fle = left(Find1,25)
If ~EXISTS(REQPATH||FULLNAME'.req') THEN Call Open(rfile,REQPATH||FULLNAME'.req',W)
else Call Open(rfile,REQPATH||FULLNAME'.req',A)
Call writeln(rfile,day||username||Pathfile||fle)
Call close(rfile)
If ~EXISTS(REQPATH||CDNAME'.req') THEN Call Open(cfile,REQPATH||CDNAME'.req',W)
else Call Open(cfile,REQPATH||CDNAME'.req',A)
Call writeln(cfile,username||Pathfile||fle)
Call close(cfile)
Signal start
/**************** Cancel **************************/
CANCEL:
FILENAME = ''
msg BYEL "8H"Left(FileName,30)"1H"
msg BYEL "28H"Left(CDNAME,30)"1H"
Return
/**************** ABOUT ***************************/
ABOUT:
CLS
pr
pr GRN' ABOUT MegaREQ'OFF
pr YEL' -----------------'OFF
pr
pr CYA' Program Name:'OFF' MegaReq Offline CD-Rom File Request'
pr CYA' Short:'OFF' MegaReq'
pr CYA' Language:'OFF' Amiga Arexx'
pr CYA' Written By:'OFF' David Huckett'
pr CYA' Date:'OFF' 16-Sep-95'
pr CYA' Description:'OFF' This program is used to allow users to be'
pr CYA' able to request files that exist on'
pr ' available CD-Rom disks which are currently'
pr ' NOT ONLINE..'
pr ' It recieves the request, and next time the CD'
pr ' that contains the file is loaded, part two of'
pr ' this program automatically copies the'
pr ' requested file(s) to system hard drives and'
pr ' either upon your next login, you will be'
pr ' notified thay are waiting, or you may'
pr ' check for waiting files from within this'
pr ' Door..'
pr
msg ' Any key to continue '
getchar
signal start
/**************** RATIO handling ******************/
RATIO:
Pr
Pr ' Sorry, but it appears you have no download file credits to enable'
Pr ' the use of this Request door.. You must upload some files'
Pr ' to the system to gain enough credits to use this facility..'
Pr
Pr ' Any confusions on the use of this program may be explained by'
Pr ' hitting (A) now for a breif explanation, or you may contact'
Pr ' the Sysop for any further help..'
Pr
prompt 2 normal ' <return> to continue (A)bout. '
key = upper(Result)
if key = 'A' then do
CLS
pr
pr
pr ' MegaReq OFFLINE CD File Request...'
pr
pr ' SHORT:'
pr ' This program allows users to specify up to five(5) files'
pr ' that exist on system CD-Rom disks, presently not loaded in a drive.'
pr
pr ' Each time a different CD disk is loaded in system drive bays,'
pr ' the system will process the names of files and if possible, any'
pr ' directory path specified, in an attempt to locate your requested'
pr ' files..'
pr
pr ' Should your requested file be located, it will be copied across to'
pr ' a buffer directory, and the next time you call and the CD that contains'
pr ' the file(s) you requested has been loaded, you will be notified that'
pr ' your requested files are waiting.. You may then add them to your'
pr ' download list or enter MegaCD and the request area to add them at a'
pr ' later time..'
pr
pr ' Please note, it is advisable to first download the CD-Rom file lists'
pr ' from within MegaCD Door, and choose the correct filenames..'
pr
Msg ' Any key to exit. '
getchar
end
Signal Quit
/**************** QUIT from door ******************/
QUIT:
SysopLog 'Exited MegaReq Door (return code 0)'
exit 0
/*************** ERROR Routine *******************/
error:
a = SIGL;message 'Error!!! Line # 'a;call delay 200
SysopLog 'ERROR MegaReq line # 'a
EXIT 10
syntax:
a = SIGL;message 'Syntax Error!!! Line # 'a;call delay 200
SysopLog 'SYNTAX ERROR MegaReq line # 'a
EXIT 10
ioerr:
message 'I/O Error!!!';call delay 200
SysopLog 'IO ERROR MegaReq.'
EXIT 10